package com.autonavi.abs.generator.core.db;

import com.autonavi.abs.generator.common.model.ColumnMeta;
import com.autonavi.abs.generator.common.model.TableMeta;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

/**
 * @author wwy
 * @version V1.0
 * <p>Description: DataSource </p>
 * @date 2020-08-10 18:37
 */
public interface MetaDataSource {

    /**
     * 获取数据源类型
     *
     * @return
     */
    String getType();

    /**
     * 初始化数据源
     *
     * @return
     */
    void initDataSource();

    /**
     * 获取数据源
     *
     * @return
     */
    DataSource getDataSource();

    /**
     * 获取连接
     *
     * @return
     */
    Connection getConnection() throws SQLException;

    /**
     * 获取表的元数据
     *
     * @return
     */
    List<ColumnMeta> getColumnList(String tableName) throws Exception;

    /**
     * 获取table list
     *
     * @return
     * @throws Exception
     */
    List<TableMeta> getTableList() throws Exception;

}
